Skip to content

Conversation

@jrauh01
Copy link
Contributor

@jrauh01 jrauh01 commented Oct 17, 2025

This PR introduces timezone support for schedules. It relies on the schedule.timezone column in the database added in Icinga/icinga-notifications#344.

For the following explanation, it is important to understand the difference between schedule and display timezone.

  • schedule timezone: the timezone the schedule is created for and stored in the database.
  • display timezone: the timezone the user want to display the schedule in.

Schedule List

The timeline part has been removed completely, so that we don't have to create a header for each schedule which wouldn't be very well readable.

Schedule Creation

The form to create a new schedule now has a dropdown menu to select the timezone the schedule will be created for. Once created, the timezone cannot be changed via the web UI, because the dropdown won't be displayed for the editAction(). This is ensured with a bool $showTimezoneDrop in the ScheduleForm which defaults to false. The dropdown's default is the same timezone as in the the user's preferences. The value of the dropdown will be stored in the schedule.timezone column.

ScheduleDateTimeFactory

The ScheduleDateTimeFactory is a util factory class which stores a display timezone statically and creates DateTime objects from it.

Schedule Detail View

The ScheduleDateTimeFactory is used to create the DateTime objects that represents the timeline start and the clock that indicates the current time in the timezone the user wants to display the schedule in. The rotation.actual_handoff and timeperiod_entry.start_time are stored as unix timestamps, so the entries are displayed correctly in the timeline grid. Additionally all date formatters are constructed with the right timezone, so all titles are displayed correctly.

Currently the user changes the display timezone via a dropdown control called TimezonePicker. This dropdown is temporarily added for development purposes and won't be in the final version.

Rotation Config Form

All configurations in the form are done in the schedule timezone, no matter what display timezone is chosen. The RotationConfigForm is now constructed with the display timezone. If the display timezone differs following will happen:

  • A warning is displayed to make the user aware that they configure the rotation in the schedule timezone.
  • The dropdowns to select times now additionally show the times as the would be in the display timezone in parantheses.
  • The first handoff hint contains the schedule timezone.

The dropdowns to select times did show 'Next Day' hints earlier. This logic has been replaced by an own option group for next day elements.

Requires Icinga/icinga-notifications#344
Fixes #273

@jrauh01 jrauh01 self-assigned this Oct 17, 2025
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Oct 17, 2025
@jrauh01 jrauh01 force-pushed the fix/schedule-timezone-handling branch from efafe1d to 1b6de94 Compare October 27, 2025 11:34
@jrauh01 jrauh01 force-pushed the fix/round-times-to-1130-pm branch from 229f6a8 to edfee49 Compare October 27, 2025 12:36
Base automatically changed from fix/round-times-to-1130-pm to main October 27, 2025 13:52
@jrauh01 jrauh01 force-pushed the fix/schedule-timezone-handling branch from 1b6de94 to c8bafa8 Compare October 27, 2025 14:17
A dropdown menu to pick a timezone.
@jrauh01 jrauh01 force-pushed the fix/schedule-timezone-handling branch from c8bafa8 to 3cb60de Compare October 27, 2025 14:22
To change the timezone to display the schedule in. Per default
the timezone the schedule is created in is used.
`ScheduleDateTimeFactory` is a factory class to create DateTime
objects in a specific timezone that is set in a static attribute.
Use the chosen value from the timezone picker control to set the
timezone attribute in `ScheduleDateTimeFactory`.
Makes use of `ScheduleDateTimeFactory`.
A Widget that represents a warning if the display timezone differs
from the schedule timezone. It's used for the forms to add and edit
rotations.
...if the display timezone differs from the schedule timezone.
Use the schedule timezone to configure rotations. All times entered
are handled in the schedule timezone.
This is because we want to remove the parentheses for future
changes where those should be used to display a time in another
timezone.
In the dropdown menu in the rotation config form show times in the
display timezone in parentheses next to the normal time (schedule
timezone).
... if the display timezone differs.
@jrauh01 jrauh01 force-pushed the fix/schedule-timezone-handling branch from 3cb60de to d0028ce Compare October 27, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improper time zone handling in schedules

1 participant